<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>连板</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">			
			.fixedBox{						
				border: 1px solid #555555;				
				white-space: nowrap;
				font-size:12px;				
			}
			.fixedBox::-webkit-scrollbar {
				width: 0px;     
				height: 0px;		
				background-color:#7c7c7c;				
			}
			table{
				width:30px;
				border-collapse:collapse; 
				text-align:center;
			}
			td,th{border:1px solid #4F4F4F}	

			.chuangyeban{
				color: #343875;										
			}

		
		</style>
	</head>
	<body>		
		<div id="towrite1" class="fixedBox"></div>	
		<div id="towrite2" class="fixedBox"></div>					
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="DatePicker/WdatePicker.js"> </script>
		<script>

			var 封占比=0.1  //封单占实际流通市值的比值 大于 门限时 标红
			var 左侧宽=248;
			var 右侧宽=290;

			var 成分数量=2000; 
            
			function toggleAutoRefresh() {
				if (intervalId) {
					// 清除定时器
					clearInterval(intervalId);
					intervalId = null;
					document.getElementById('refreshButton').textContent = '开启自动刷新';
				}
				else
				{
					intervalId = setInterval(function() {	
						start();																				
					},5000);
					document.getElementById('refreshButton').textContent = '关闭自动刷新';
				}
			}


			<!-- var narrow = 0;  //宽屏为0，窄屏为1；			 -->
			var bkcolor = $("body").css("backgroundColor");		
			var cybcolor = "#343875";		
			var dt = "";
			var tt = "";
			var gt = "";
			var k = "0";
			window.onload = function() {
				var day = new Date();
				gt = day.getTime();
				mymonth = day.getMonth()+1;
				myday = day.getDate();
				if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
				if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
				tt = day.getFullYear() + "-" + mymonth + "-" + myday;	
				dt = tt;
				changeStyle();
				start();
				
			}

			
			
						
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
					start();
					update(bdm + "#" + bkmc);
					
					if(trid != ""){
						changeTCss(objt,trid,"towrite2")
					}
					if(trid1 != ""){
						changeCss(objt1,trid1,"towrite1")
					}
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　

			///自动刷新
			var intervalId;
			$(function() {
				intervalId = setInterval(function() {

					const dayOfWeek = (new Date()).getDay();
					var kkr=0;
					//今天是星期六或者星期日
					if (dayOfWeek === 0 || dayOfWeek === 6) {
						kkr=1;
					} 

					// if(kkr === 0){
					// 	start();	
					// } 

					if(k == "0" && kkr===0){
						time_range("09:00","15:15")	
					}
																							
				},10000);
			}) 
   　　　
			// $(function() {
			// 	setInterval(function() {
			// 		if(k == "0"){
			// 			time_range("09:00","15:15")	
			// 		}									
			// 	},
			// 	10000);
			// })

			//$(makeSortable1('cf1'))
			
			function changeStyle() {				
				var obj1 = document.getElementById("towrite1");	
				obj1.style.marginTop= "-10px";	
				obj1.style.padding="0px";		
				obj1.style.left= "0px"; 	
				obj1.style.width= 左侧宽+"px";
				obj1.style.height= "100%";
				obj1.style.fontSize="12px";
				obj1.style.border= "0px solid #968d8d80";
				obj1.style.borderRight= "1px solid #968d8d80";
				
				var obj2 = document.getElementById("towrite2");
				obj2.style.marginTop= "10px";	
				obj2.style.padding="0px";
				obj2.style.left= 左侧宽+1+"px";
				obj2.style.width= 右侧宽+"px";
				obj2.style.height= "98%";
				obj2.style.fontSize="12px";	 
				obj2.style.border= "0px solid #968d8d80";
			}
			
			Date.prototype.Format = function (fmt) {
			var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
			};
			
			if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			function getLocalTime(nS) {			          
			return new Date(parseInt(nS) * 1000).Format("hh:mm:ss")}
			
			function keepTwoDecimal(num) {  
               var result = parseFloat(num);  
               if (isNaN(result)) {  
                   //alert('传递参数错误，请检查！');  
                   return false;  
               }  
               result = Math.round(num * 100) / 100;  
               return result;  
			};
			
		
			
			var trid1 = "";
			var ty = "";
			var objt1 = "";

			///左边鼠标点击 变颜色
			function changeCss(obj,hid,id){
				//alert(id)
				objt1 = obj;
				ty = obj.id.split("#")[1];
				
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){
					var dm = tlist[i].id.split("#")[0];
					var yy = tlist[i].id.split("#")[1];
					//alert(tlist[i].id)
					if(yy == ty && ty != ""){
					
						if(dm == hid){
							tlist[i].style.backgroundColor = "#4F4F4F";
							trid1 = hid;
						}else{
							tlist[i].style.backgroundColor = "#68228B"; //相同涨停原因   68228B
						}

					}else{
						//tlist[i].style.backgroundColor = bkcolor; 

						if(tlist[i].className !="chuangyeban" ){
						tlist[i].style.backgroundColor = bkcolor; 		
						}else{
							tlist[i].style.backgroundColor = cybcolor; 
						}	
					}

					

				}
				trid = "";  //清除右侧记录，高亮左侧点击代码
			}
			
			var trid = "";
			var objt = "";

			/////右边鼠标点击 变颜色
			function changeTCss(obj,hid,id){	
				objt = obj;
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){						
					if(tlist[i].className !="chuangyeban" ){
						tlist[i].style.backgroundColor = bkcolor; 		
					}else{
						tlist[i].style.backgroundColor = cybcolor; 
					}	 	 
				}
				trid = hid;
				var tr = document.getElementById(hid);
				if(tr){
					tr.style.backgroundColor = "#4F4F4F";  //483D8B
				} 
 
				Leftlight(hid);
				
				trid1 = ""; //清除左侧记录，高亮右侧点击代码
				ty = "";				
			}
			
			function changeCss1(obj,id){				
				var alist = document.getElementById(id).getElementsByTagName("a");				
				for(var i = 0; i < alist.length; i++){				
					if(alist[i] == undefined){
						break;
					} 
					
					alist[i].style.color = "#E5E5E5"; //给所有a标签赋原色


				}
				//ranking();
				obj.style.color = "#00FFFF"; //令当前标签高亮				
			}
			
			//towrite2 鼠标经过事件
			function hover2(){  //鼠标经过
				//alert("1:" + trid1 + "}2:"+trid)
				var rows = document.getElementById("towrite2").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){				
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}

					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头
							if(this.id == trid || this.id == trid1){  //过滤选中行
								this.style.background="#4F4F4F";
							}else{
								this.style.background=bkcolor;

								if(this.id.substr(0,2)=="30" || this.id.substr(0,2)=="68"){
							    this.style.background  = "#343875";
						    }
							} 
						}						
					}					
				}
			}

			//towrite1 鼠标经过事件
			function hover1(){  //鼠标经过
				var rows = document.getElementById("towrite1").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){			
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头						
							var dm = this.id.split("#")[0];
							var yy = this.id.split("#")[1];
							if(dm == trid1 || dm == trid){
								this.style.background="#4F4F4F"; //483D8B
							}else if(yy == ty){								
								this.style.background="#68228B";														
							}else{
								this.style.background=bkcolor;
								if(this.id.substr(0,2)=="30" || this.id.substr(0,2)=="68"){
							    this.style.background  = "#343875";
						    } 
							}
							
						}						
					}					
				}				
			}
			
			//左侧高亮
			function Leftlight(hid){
				var div = document.getElementById("towrite1");
				$("#towrite1").scrollTop (0);
				var alist = document.getElementById('towrite1').getElementsByTagName("tr");					
				for(var i = 0; i < alist.length; i++){
					var dm = alist[i].id.substr(0,6);
					//alert(dm)
					if(dm == hid){
						alist[i].style.backgroundColor = "#bF4baF";
						var y = getTop(alist[i]);  //纵坐标
						//alert(y)
						if(y > div.clientHeight){						
							$("#towrite1").scrollTop (y - 100);  //控制滚动条
						}
					}else{
						alist[i].style.backgroundColor = bkcolor;
					}					
				}												
			}
			
			//获取元素的纵坐标 
			function getTop(e){ 
				var offset=e.offsetTop; 
				if(e.offsetParent!=null) offset+=getTop(e.offsetParent);				
				return offset; 
			} 		
			
			function cDayFunc(dp){ 
				var date = dp.cal.getNewDateStr();            
				BookingRmk(date);//调用其它函数并带上参数                
			}
			
			function BookingRmk(date){         
				tt = date;
				var date1 = new Date(tt);
				var date2 = new Date(dt);						
				k = 0;
				if(date1.getTime() < date2.getTime()){			
					k = 1;					
					tradeday();					
				}
				//切换日期，初始化
				bdm = "";
				type = 6;
				order = 1;
				old = 1;
				gl = "领涨";
				rn = 6;
				
				trid = "";
				objt = "";
				
				start();						
			}
			
			function prev(){  //前一天
				pn = -1;
				var day = new Date(tt);	
				day.setTime(day.getTime() - 24*60*60*1000);	
				tt = day.Format("yyyy-MM-dd");
				BookingRmk(tt);				
			}
			
			function next(){  //后一天 				
				pn = 1;
				var day = new Date(tt);	
				day.setTime(day.getTime() + 24*60*60*1000);	
				tt = day.Format("yyyy-MM-dd");
				BookingRmk(tt);							
			}
			
			var pn = -1;
			function tradeday() {  //判断最后交易日
				var day = new Date(tt);							
				for (i = 1; i < 100; i++){	//节假日																										
					if(i > 1){
						day.setTime(day.getTime() + pn*24*60*60*1000);							
					}	
					tt = day.Format("yyyy-MM-dd");
					//alert(tt);
					if(tt == dt){	
						k = 0;
						start();
						break;
					}
					//var url = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=RealRankingInfo&st=30&apiv=w26&Type=1&c=ZhiShuRanking&PhoneOSNew=1&ZSType=7&Date=" + tt; 			
					var url = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=RealRankingInfo&st=30&apiv=w26&Type=1&c=ZhiShuRanking&PhoneOSNew=1&ZSType=7&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&Date=" + tt; 
					var res = [];
					$.ajax({
						type: "get",
						url: url,
						dataType: "json",
						async : false,
						cache:false,
						timeout:3000,						
						success: function(data) {							
							res = data.list;							
						}
					});
					if(res.length != 0){						
						break;
					}
				}
			}	
						
						
			function start() {
				datas = "";
				div = document.getElementById('towrite1');										
				div.innerHTML = '<font size="3" >日期&nbsp;&nbsp;</font><input style="width: 90px;height:15px;" type="text" id="PriceDate" name="PriceDate" class="Wdate" onFocus="WdatePicker({ onpicking: cDayFunc})" />';						
				var back = '<a href="javascript:prev();" style="padding-left:10px;font-size:8px;color:#fff;">←</a>';				
				var forward = '<a href="javascript:next();" style="font-size:8px;color:#fff;">→</a>';
				div.innerHTML += back + forward ;
				
				for (i = 0; i < 5; i++){
					getSource(5 - i);					
				}
				hover1(); 
				
				document.getElementById("PriceDate").value = tt;				
			}
			
			var fx = 1;  //连板时间顺序
			var n = 0;
			function getSource(ss) {				
				q = ss;
				//var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + fx + "&a=DailyLimitPerformance&st=60&apiv=w21&Type=4&c=HomeDingPan&PidType=" + ss;
				//var url2 = "https://apphis.longhuvip.com/w1/api/index.php?Order=" + fx + "&a=DailyLimitPerformance&st=1000&apiv=w26&Type=4&c=HisHomeDingPan&Index=0&PidType=" + ss + "&Day=" + tt;				
				var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + fx + "&a=DailyLimitPerformance&st=150&apiv=w21&Type=4&c=HomeDingPan&&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PidType=" + ss;
				var url2 = "https://apphis.longhuvip.com/w1/api/index.php?Order=" + fx + "&a=DailyLimitPerformance&st=1000&apiv=w26&Type=4&c=HisHomeDingPan&Index=0&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PidType=" + ss + "&Day=" + tt;				
				var url = url1;
				if(k == "1"){
					url = url2;
				}
				if(ss == "5"){										
					bt = "四板以上：";					
				}else if(ss == "4"){					
					bt = "四板：";					
				}else if(ss == "3"){					
					bt = "三板：";					
				}else if(ss == "2"){					
					bt = "二板：";					
				}else if(ss == "1"){					
					bt = "一板：";
				}								
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,						
					success: function(data) {					
						var arr = data.info;
						if(ss == 1 && k == 0){
							tt = arr[1];
							dt = tt;
						}						
						var arry = arr[0];						
						if(arry.length > 0){
							for (var j = 0; j < arry.length; j++){
								var code = arry[j][0];
								var ztyy = arry[j][5];
								//res.push({"code":code,"name":arry[j][1],"zttime":getLocalTime(arry[j][4]),"ztyy":ztyy,"lb":arry[j][18]});  //修改了代码
								res.push({"code":code,"name":cutStr(arry[j][1],8),"zttime":getLocalTime(arry[j][4]),"ztyy":cutStr(ztyy.replace("概念","").replace("汽车零部件","汽配"),8),"fd":arry[j][6],"sjsz":arry[j][13]});
								if(n == 0){										
									getbk(code + "#" + ztyy);
								}
								n++;
							}
						}
					}
				});
				tables(res,bt);		
			} 

			/*
			* param str 要截取的字符串
			* param L 要截取的字节长度，注意是字节不是字符，一个汉字两个字节
			* return 截取后的字符串
			*/
			function cutStr(str,L){    
				var result = '',
					strlen = str.length, // 字符串长度
					chrlen = str.replace(/[^\x00-\xff]/g,'**').length; // 字节长度

				if(chrlen<=L){return str;}
				
				for(var i=0,j=0;i<strlen;i++){
					var chr = str.charAt(i);
					if(/[\x00-\xff]/.test(chr)){
						j++; // ascii码为0-255，一个字符就是一个字节的长度
					}else{
						j+=2; // ascii码为0-255以外，一个字符就是两个字节的长度
					}
					if(j<=L){ // 当加上当前字符以后，如果总字节长度小于等于L，则将当前字符真实的+在result后
						result += chr;
					}else{ // 反之则说明result已经是不拆分字符的情况下最接近L的值了，直接返回
						return result;
					}
				}
			}
			
			var q = 0; 
			function tables(data,bt) {
				if(data.length != 0){					
					var json = data;
					

					//创建table					
					var table=document.createElement("table");										
					var thead=document.createElement("thead");
					table.appendChild(thead);		
					table.id = "cf1";			
					var tr=document.createElement("tr");
					thead.appendChild(tr);					
					
					var m = 0;
					var v = 0;
					var b = 0;
					for(var key in json[0]){  //表头													
						key = key.replace('code','代码').replace('name','名称').replace('ztyy','涨停原因').replace('lb','连板').replace('zttime','涨停时间').replace('fd','封单').replace('sjsz','市值z');						
						
						var th=document.createElement("th");	

						th.innerHTML=key;		 

						tr.appendChild(th);
						if(key == "涨停时间" ){
							v = m;							
							th.style.color = "#FF6633";			
							// th.style.maxWidth = "30px";
							// th.style.textOverflow="ellipsis"
							// th.style.whiteSpace="nowrap";			
						}
						// if(key == "名称" ){
						// 	th.style.maxWidth = "3px";
						// 	th.style.textOverflow="ellipsis"
						// 	th.style.whiteSpace="nowrap";			
						// }	
						if(key == "涨停原因" ){
							b = m;							
							//th.style.color = "#FFA500";							
						}	 

						m++;
					}
										
					var tbody=document.createElement("tbody");					
					table.appendChild(tbody);
					
					//遍历json
					// json = json.sort((a,b)=>{
					// 	return a.ztyy.toLowerCase().localeCompare(b.ztyy.toLowerCase());
					// }); 

					var numberParts = '';
					for(var i = 0; i < json.length; i++){					
						var tr=document.createElement("tr");						
						var p = 1;
						var dm = "";
						//var mc = "";
						var ztyy = "涨停原因";						
						for(var key in json[i]){ //行元素遍历		
							var td=document.createElement("td");														
							var rc = json[i][key];
							if(p == 1){  //代码列
								dm = rc;			
								
								if(dm.substring(0, 2)=="30"){
								tr.className= "chuangyeban";  //创业板的判断
								}

								// 300 688 689 301 变色
								if(dm.substr(0,2)=="30" || dm.substr(0,2)=="68"){
									tr.style.backgroundColor  = "#343875";
									//2F4F4F
								}

							}

							if(key=="fd" || key=="sjsz"){
								let a=0;
								if(rc>=100000000){
									let k = (rc / 100000000);
									// 先以 a=2 进行计算
									let tempK = k.toFixed(2);
									if (tempK.length > 5) {
										a = 0;
									} else {
										a = 2;
									}

									rc=(rc/100000000).toFixed(a)+"亿";

								}else{
									rc=(rc/10000).toFixed(a)+"万";
								} 
							} 
							

							if(p == b + 1){
								ztyy = rc;
								tr.id = dm + "#" + ztyy;
							}

							var _width="";
							if(key=="name"){
								_width = "50px";
							} 

							//zttime
							if(key=="zttime"){
								_width = "30px";
							} 

							//ztyy
							if(key=="ztyy"){
								_width = "50px";
							} 

							//fd
							if(key=="fd"){
								_width = "40px";
							} 

							//sjsz
							if(key=="sjsz"){
								_width = "45px";
							} 

							

							td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "#" + ztyy + "' onclick='changeCss(this,\"" + dm + "\",\"towrite1\");getbk(\"" + dm + "\"+\"#\"+\"" + ztyy + "\")'>" + rc + "</a>";							
							
							td.style="max-width: "+_width+";text-overflow:ellipsis;white-space:nowrap;";

							if(key=="fd"){
								var fd = json[i]["fd"];
								var sjsz=json[i]["sjsz"];
								//封单 占实际市值 5%  标红
								if(fd/sjsz > 封占比){
										td.getElementsByTagName("a")[0].style.color = "#fd0303"; // 红色
										td.getElementsByTagName("a")[0].style.fontWeight='bold';
									}
							}

							if(key=="sjsz"){
								var sjsz=json[i]["sjsz"];
								//封单 占实际市值 5%  标红
								if((sjsz/100000000) >= 50){
										td.getElementsByTagName("a")[0].style.color = "yellow"; // 红色
										td.getElementsByTagName("a")[0].style.fontWeight='bold';
									}
							}

							if(p == v + 1){							
								td.getElementsByTagName("a")[0].style.color = "#FF6633";								
							}
							tr.appendChild(td);
							p++;
						}

						tr.innerHTML = tr.innerHTML.replace(/涨停原因/g,ztyy);
						tbody.appendChild(tr);

						//代码拼接	
						var numberPart = dm;
						if(numberPart.substring(0, 1) === '0' ||  numberPart.substring(0, 1) === '3')
						numberPart='0#'+numberPart;

						if(numberPart.substring(0, 1) === '6')
						numberPart='1#'+numberPart; 

						if(numberPart.substring(0, 1) === '4' ||  numberPart.substring(0, 1) === '8' ||  numberPart.substring(0, 1) === '9')
						numberPart='2#'+numberPart; 

						numberParts+=numberPart;
						numberParts+="|"; 

					}
					
					var div = document.getElementById("towrite1");
					var sx2 = "<a style='color:#FFD700;font-size:12px' href='http://www.treeid/AddToBlock_"+numberParts+"'>" + bt + "(" + json.length + ")</a>";	
					var bts = "<ul style='margin:2px;margin-top:10px;'>"+sx2;		
					var autobutton ='</ul>';		

					if(!bt.indexOf("一板")){
						autobutton ='<a href="javascript:void(0);" id="refreshButton" style="position:absolute; right:0px;" onclick="toggleAutoRefresh()">关闭自动刷新</a>'+'</ul>';
					};

					div.innerHTML += bts+autobutton;
					
					div.appendChild(table);															
					table.style.width = "180px"; //题材表宽 
					changeTable(table,'0');		//隐藏某列		
					
					makeSortable1(table);		//添加排序	
				}				
			}

			//function makeSortable1(tableId) {  
			function makeSortable1(tbl) {  
				//const table = document.getElementById(tableId);  
				const table = tbl;
				console.log(' not find_table')
				if (!table) return; // 如果找不到表格，则返回  
				console.log('find_table');
				const headerRow = table.querySelector('thead tr');  
				const headers = headerRow ? headerRow.getElementsByTagName('th') : [];  
			
				// 为每个表头添加点击事件监听器  
				for (let i = 0; i < headers.length; i++) {  
					headers[i].addEventListener('click', function() {  
						//// 移除之前已排序的列的样式  
						console.log('移除之前已排序的列的样式 ');
						const sortedHeaders = headerRow.getElementsByClassName('sorted');  
						for (let j = 0; j < sortedHeaders.length; j++) {  
							sortedHeaders[j].classList.remove('sorted');  
						}  
			
						console.log('给当前点击的列添加样式   ');
						this.classList.add('sorted');  
			
						// 获取表格体和行进行排序  
						const tbody = table.getElementsByTagName('tbody')[0];  
						const rows = tbody.getElementsByTagName('tr');  
						const isNumeric = !isNaN(this.textContent.trim());  
						const sortedColumn = this;  
						// 临时数组，用于存储排序的行  
						const sortedRows = Array.from(rows);  
			
						console.log('根据当前列的内容进行排序   ');
						sortedRows.sort(function(a, b) {  
						const cellA = a.getElementsByTagName('td')[i].textContent.trim();  
						const cellB = b.getElementsByTagName('td')[i].textContent.trim();  
			
						let comparison = 0;  
						if (isNumeric) {  
							comparison = Number(cellA) - Number(cellB);  
						} else {  
							comparison = cellA.localeCompare(cellB);  
						}  
			
						// 使用保存的引用而不是this  
						if (sortedColumn.classList.contains('desc')) {  
							comparison = -comparison;  
						}  
			
						// 根据比较结果排序  
						return comparison;  
					});  
			
					// 清空tbody并重新添加已排序的行  
					while (tbody.firstChild) {  
						tbody.removeChild(tbody.firstChild);  
					}  
			
					sortedRows.forEach(function(row) {  
						tbody.appendChild(row);  
					});  
			
					// 切换排序方向  
					sortedColumn.classList.toggle('desc');  
				});  
				}  
			} 
			
			function UnUnicode(str) {
				return unescape(str.replace(/\\/g, "%"));
			}
			
			function NumberTransform(num) { 
				var result = num;
               if(Math.abs(num) > 100000000){
			    result = num / 100000000;
				result = result.toFixed(2) + "亿";
			   }else if(Math.abs(num) > 10000){
			    result = num/10000;
				result = result.toFixed(0) + "万";
			   }				   
               return result;  
			};			
			
			var gpdm = "";
			var bkmc = "";
			var bdm = "";
			function getbk(ss) {			
				var gp = ss.split('#');				
				gpdm = gp[0];
				bkmc = gp[1];
				div = document.getElementById('towrite2');										
				div.style.fontSize="12px";	
				
				//var url = "https://apphq.longhuvip.com/w1/api/index.php?a=GetFeaturedSection&c=StockL2Data&apiv=w26&StockID=" + gpdm;
				var url = "https://apphq.longhuvip.com/w1/api/index.php?a=GetFeaturedSection&c=StockL2Data&apiv=w26&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm;
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,						
					success: function(data) {
						//document.write(JSON.stringify(data));
						res = data;
					}
				});
				for (var i = 0; i < res.info.length; i++){
					var mc = res.info[i][1];
					if(mc == bkmc){
						bdm = res.info[i][0];
					}
				}
				update(bdm + "#" + bkmc);				
			}
			
			// 四舍五入到指定的小数位数
			function roundToDecimalPlace(number, decimalPlaces) {
				const factor = Math.pow(10, decimalPlaces);
				return Math.round(number * factor) / factor;
			}		
			
			
			//加入板块
			function copyintobak(){ 
				var divElement = document.getElementById('towrite2');
				var aElements = divElement.querySelectorAll('a');
				// 遍历并处理所有a元素
				var numberParts = "";
				aElements.forEach(a => {
					const parts = a.href.split('_');
					if(parts.length>1) {
						var numberPart = parts[1];
						if(numberPart.substring(0, 1) === '0' ||  numberPart.substring(0, 1) === '3')
						numberPart='0#'+numberPart;

						if(numberPart.substring(0, 1) === '6')
						numberPart='1#'+numberPart; 

						if(numberPart.substring(0, 1) === '4' ||  numberPart.substring(0, 1) === '8' ||  numberPart.substring(0, 1) === '9')
						numberPart='2#'+numberPart; 

						numberParts+=numberPart;
						numberParts+="|"; 
						
					} 
					
				});
				
				numberParts=numberParts.trim('|');
				window.location.href='http://www.treeid/AddToBlock_'+numberParts; 
			}

			var gl = "领涨"; 
			var type = 6;
			var order = 1;
			var old = 1;
			var rn = 6;
			var bj = [];
			function update(ss) {
				if(ss != "0"){
					var dms = ss.split('#');
					bdm = dms[0];
					bkmc = dms[1];								
				}

				var sx2 = "<a style='position:absolute; right:-5px;font-size:11px;' href='javascript:void(0)' onclick='copyintobak()'>+板块</a>";	
				var bfyy = "<a style='position:absolute; right:125px;font-size:11px;' href='javascript:void(0)' onclick='updateb()'>【爆发原因】</a>";
				var zz = "<a style='position:absolute; right:90px;font-size:11px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";
				var ggxq = "<a href='http://www.treeid/dlglocalurl##homepath##/T0002/signals/gp/个股详情D4.html?##xxxxxx####STOCKNAME##&tdxmyietitle=个股详情&tdxmyiewidth=490&tdxmyieheight=738&tdxmyielastpos=1&canchangesize=1' style='position:absolute; right:35px;font-size:11px;'>个股详情</a>";
				var jbm = "<a href='http://www.treeid/dlglocalurl##homepath##company/" + encodeURI('基本面') + ".html##xxxxxx####STOCKNAME##' style='float:right;font-size:14px;'>基本面</a>";				

				div = document.getElementById('towrite2');				
				div.innerHTML = '<h4><font color="yellow">' + bkmc +'</font>'+ bfyy + zz +ggxq+sx2 + '</h4>';	//'<h4>' + bkmc + bfyy + zz + ggxq + jbm + '</h4>';			
				//var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + order + "&st=30&a=ZhiShuStockList_W8&c=ZhiShuRanking&PhoneOSNew=1&old=" + old + "&apiv=w21&Type=" + type + "&PlateID=" + bdm; 								
				//var url2 = "https://apphis.longhuvip.com/w1/api/index.php?st=30&Index=0&old=" + old + "&Order=" + order + "&a=ZhiShuStockList_W8&apiv=w26&Type=" + type + "&c=ZhiShuRanking&PhoneOSNew=1&PlateID=" + bdm + "&Date=" + tt;				
				var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + order + "&st="+成分数量+"&a=ZhiShuStockList_W8&c=ZhiShuRanking&PhoneOSNew=1&old=" + old + "&apiv=w21&Type=" + type + "&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PlateID=" + bdm; 								
				var url2 = "https://apphis.longhuvip.com/w1/api/index.php?st="+成分数量+"&Index=0&old=" + old + "&Order=" + order + "&a=ZhiShuStockList_W8&apiv=w26&Type=" + type + "&c=ZhiShuRanking&PhoneOSNew=1&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PlateID=" + bdm + "&Date=" + tt;		
				var url = url1;
				if(k == "1"){
					url = url2;
				}			
				
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))					
						//document.write(JSON.stringify(data));							
						
						for (i = 0; i < data.list.length; i++){
							//res.push({"code":data.list[i][0],"name":data.list[i][1],"zf":data.list[i][6],"zs":keepTwoDecimal(data.list[i][9]),
							//"zlje":NumberTransform(data.list[i][13]),"lzcs":data.list[i][40],"lz":data.list[i][24],"zl":data.list[i][2],"lb":data.list[i][23],"zt":data.list[i][39]});	
							
							res.push({"code":data.list[i][0],"name":data.list[i][1],"zf":data.list[i][6],"zs":keepTwoDecimal(data.list[i][9]),"lb":data.list[i][23].replace('昨日','昨').replace('连','').replace('天',','),"zl":data.list[i][2],
							"lz":data.list[i][24],"sjsz":data.list[i][10],"zt":data.list[i][39].replace('概念','').replace('工业','').replace('绿色','绿').replace('电力','电').replace('柴油发','柴发'),"lbi":roundToDecimalPlace(data.list[i][21],2),"yiz":data.list[i][33]});	


						}											
					}
				});				

				//document.write(data2);
				
				//var json = JSON.parse(data2);
				var json = res;	
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);	 
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				var m = 0;
				var v = 0;
				var b = 0;
				bj = [];
				for(var key in json[0]){  //表头													
					key = key.replace('code','代码').replace('name','名称').replace('zf','涨幅%').replace('zlje','主力净额').replace('lzcs','领涨次数').replace('lbi','量比');
					key = key.replace('lb','连板').replace('zt','主题').replace('zs','涨速').replace('zl','主力').replace('lz','领涨').replace('sjsz','市值z');
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);					
					if(key == "领涨" || key == "主力" || key == "连板" || key == "主题"){
						bj.push(m);
						th.style.color = "#FFA500";	
					}		 

					if(m == rn){
						th.style.color = "#FFFF80";						
					}

					m++;
				}

				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){					
					var tr=document.createElement("tr");						
					var p = 1;	
					var dm = "";
					var mc = "";	
					var clas="";	//class			
					for(var key in json[i]){ //行元素遍历					
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						if(p == 1){  //代码列
							dm = rc;
							tr.id = dm;

							if(dm.substring(0, 2)=="30"){
								tr.className= "chuangyeban";  //创业板的判断
							}
						
							// 300 688 689 301 变色
						if(dm.substr(0,2)=="30" || dm.substr(0,2)=="68"){
							tr.style.backgroundColor  = "#343875";
							//2F4F4F
						}

						}	

						if(key=="zs"){
							var yz = json[i]["yiz"];
							var zf = json[i]["zf"];
							var fd = json[i]["fd"];

							if ((fd>0 && yz==0)||(zf<-8 && yz==0)){
								rc = "一字";  
							} 

							if (yz==0 && zf===0){
								rc = "停牌";  
							}
						} 
						if(key=="fd" || key=="sjsz"){
								let a=0;
								if(rc>=100000000){
									let k = (rc / 100000000);
									// 先以 a=2 进行计算
									let tempK = k.toFixed(2);
									if (tempK.length > 5) {
										a = 0;
									} else {
										a = 2;
									}

									rc=(rc/100000000).toFixed(a)+"亿";

								}else{
									rc=(rc/10000).toFixed(a)+"万";
								} 
							} 


						var _width="";
							if(key=="name"){
								_width = "52px"; 
							}  
							if(key=="zf"){
								_width = "10px"; 
							}  
 
							if(key=="zs"){
								_width = "30px"; 
							} 

							if(key=="lb"){
								_width = "40px"; 
							} 

							if(key=="sjsz"){
								_width = "48px";
								
							}   
							
						td.style="max-width: "+_width+";text-overflow:ellipsis;white-space:nowrap;";
						td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p +"' onclick='changeTCss(this,\"" + dm + "\",\"towrite2\")'>" + rc + "</a>";
						
						if(key=="zt"){
								_width = "72px";
								td.style="min-width: "+_width+";text-overflow:ellipsis;white-space:nowrap;";
							} 

								
						 
						if(bj.indexOf(p - 1) > -1){	 //需要BJ的列
							td.getElementsByTagName("a")[0].style.color = "#FFA500"; 
						}	
						 
						if(p == rn + 1){														
							var value = parseFloat(JSON.stringify(rc).replace('万','').replace('亿','').replace(/"/,''));
							if(!isNaN(parseFloat(value)) && isFinite(value)){  //判断列是否为数字
								if(value >= 0){
									td.getElementsByTagName("a")[0].style.color = "#FF6633";
								}else{
									td.getElementsByTagName("a")[0].style.color = "#00FF00";
								}
							}else{								
								td.getElementsByTagName("a")[0].style.color = "#FF6633";								
							}
						}
						
						if(rc == "破板"){
							td.getElementsByTagName("a")[0].style.color = "#00FF00"; 
						}

						if(key=="lb"){
							var zb = json[i]["lz"];
							if (zb=="破板"){ 
								td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p +"' onclick='changeTCss(this,\"" + dm + "\",\"towrite2\")'>" + zb + "</a>";
								td.getElementsByTagName("a")[0].style.color = "#00ff00"; //绿色
							} 
						}

						if(key=="sjsz"){
								var sjsz=json[i]["sjsz"];
								//封单 占实际市值 5%  标红
								if((sjsz/100000000) <= 20){
										td.getElementsByTagName("a")[0].style.color = "#63d3f8"; // 
										td.getElementsByTagName("a")[0].style.fontWeight='bold';
									}
							}

						if(key=="zs"){
							var yz = json[i]["yiz"];
							var fd = json[i]["fd"];
							var zf = json[i]["zf"];
							if (fd>0 && yz==0){ 
								td.getElementsByTagName("a")[0].style.color = "yellow"; // 红色
								td.getElementsByTagName("a")[0].style.fontWeight='bold';
							} 

							if (zf<-8 && yz==0){ 
								td.getElementsByTagName("a")[0].style.color = "#00ff00"; // 绿色
								td.getElementsByTagName("a")[0].style.fontWeight='bold';
							} 
						} 


						tr.appendChild(td);
						p++;
					}	

					tbody.appendChild(tr);
				}
				//var div = document.getElementById("towrite2");
				div.style.whiteSpace = "nowrap";				
				div.appendChild(table);
				changeTable(table,'0');		//隐藏某列
				changeTable(table,'6');
				changeTable(table,'5');
				changeTable(table,'10');
				changeTable(table,'9');
				makeSortable(table);			
				hover2();
				search();
			}
			
			//隐藏某列				
            function changeTable(table,ss) {	
				var trs = table.rows;
				ss = ss + '#';
				var aa = ss.split('#');
				for (var j = 0; j < aa.length; j++) {
					if(aa[j] != ""){
						for (var i = 0, len = trs.length; i < len; i++) {					
							var p = aa[j];
							var cell = trs[i].cells[p]; 
							cell.style.display = 'none';
						}
					}
				}					
			}
			
			var sfx = 0;  //自动刷新开关
			var fls = false;  //排序方向
			function makeSortable(table) {
				var headers=table.getElementsByTagName("th");
				for(var i=0;i<headers.length;i++){				
					(function(n){
						var flag=false;
							
						headers[n].onclick=function(){													
							rn = n;
							gl = headers[n].textContent;	//获取								
							if(n == 2){		       //涨幅													
								old = 0;
								type = 6;														
							}else if(n == 3){		//涨速						
								type = 7;															
							}else if(n == 4){	    //净额						
								type = 1;
							}else if(n == 5){	    //领涨次数						
								type = 27;
							}else if(n == 7){	    //实际流通市值						
								type = 2;
							}
							
							if(n >= 2 && n <= 7){
								if(order == 1){
									order = 0;									
								}else{
									order = 1;									
								}
								update("0");
							}else{
								if(type != 6 || old != 1){
									type = 6;
									old = 1;
									order = 1;
									update("0");
								}
								// showCol(n,bj);	//高亮
							}			
								
							var tbody=table.tBodies[0];
							var rows=tbody.getElementsByTagName("tr");
							rows=Array.prototype.slice.call(rows,0);

							//基于第n个<td>元素的值对行排序
							rows.sort(function(row1,row2){
								headtxt = headers[n].textContent;								
								var cell1=row1.getElementsByTagName("td")[n];//获得第n个单元格
								var cell2=row2.getElementsByTagName("td")[n];																
								var val1=cell1.textContent||cell1.innerText;//获得文本内容
								var val2=cell2.textContent||cell2.innerText;
								if(headtxt.indexOf("名称") != -1 || headtxt=="主力" || headtxt.indexOf("主题") != -1){
									val1 = val1;
									val2 = val2;
								}else if(headtxt.indexOf("连板") != -1){								
									val1 = val1.replace("昨日首板","-1").replace("首板","1").replace("连板","");
									if(val1.indexOf("天")>-1){
										val1 = val1.split("天")[0];
									}else if(val1.indexOf("昨")>-1){
										val1 = 0;
									}else if(val1 == ""){
										val1 = -2;
									}										
									val1 = parseFloat(val1);
								
									val2 = val2.replace("昨日首板","-1").replace("首板","1").replace("连板","");
									if(val2.indexOf("天")>-1){
										val2 = val2.split("天")[0];
									}else if(val2.indexOf("昨")>-1){
										val2 = 0;
									}else if(val2 == ""){
										val2 = -2;
									}									
									val2 = parseFloat(val2);
								}else if(headtxt.indexOf("领涨") != -1){
									val1 = val1.replace("龙十","龙一十").replace("破板","1000");
									val2 = val2.replace("龙十","龙一十").replace("破板","1000");
									if(val1 == ''){
										val1 = '1001';
									}
									if(val2 == ''){
										val2 = '1001';
									}
									if(val1.indexOf("龙") != -1){
										val1 = ChineseToNumber(val1.replace("龙",""));										
									}										
									if(val2.indexOf("龙") != -1){
										val2 = ChineseToNumber(val2.replace("龙",""));
										
									}
									//val2 = parseFloat(val2);									
								}else{
									if(val1 == "-"){
										val1 = " ";
									}
									if(val2 == "-"){
										val2 = " ";
									}
									val1 = val1.replace(" ","0").replace("无","1000").replace("NaN","0");
									val2 = val2.replace(" ","0").replace("无","1000").replace("NaN","0");
									if(val1.indexOf("万") != -1){
										val1 = parseFloat(val1)*10000;
									}else if(val1.indexOf("亿") != -1){
										val1 = parseFloat(val1)*100000000;
									}else{
										val1 = parseFloat(val1);
									}
									
									if(val2.indexOf("万") != -1){
										val2 = parseFloat(val2)*10000;
									}else if(val2.indexOf("亿") != -1){
										val2 = parseFloat(val2)*100000000;
									}else{
										val2 = parseFloat(val2);
									}
								}
								if(val1<val2){
									return -1;
								}else if(val1>val2){
									return 1;
								}else{
									return 0;
								}
								
							});
							
							if(sfx == 1){   //自动刷新时，保持排序方向
								flag = fls;								
							}
							fls = flag;							
							sfx = 0;
							
							if(flag){
								rows.reverse();								
							}
							
							for(var i=0;i<rows.length;i++){
								tbody.appendChild(rows[i]);
							}

							flag=!flag;									
						}
					}(i));
				}				
			}
			
			function showCol(iCol,arr){	 //(选中列，标记列)	
				var oTable = document.getElementsByTagName('table')[0];						
				//表头
				var th = oTable.getElementsByTagName("th");						
				for (var i=0;i < th.length; i++){	    //列遍历
					th[i].style.color = "#E5E5E5";      //还原					
					if(arr.length > 0 && arr.indexOf(i) > -1){  //BJ列高亮
						th[i].style.color = "#FFA500";
					}
					th[iCol].style.color = "#FFFF80";	//选中				
				}
				
				var tr = oTable.getElementsByTagName("tr");	
				for (var i=1;i < tr.length; i++){	//行遍历
					var otagsA = tr[i].getElementsByTagName("a");
					for (var j=0;j < otagsA.length; j++){	//列遍历
						otagsA[j].style.color = "#E5E5E5";	//还原																
						if(arr.length > 0 && arr.indexOf(j) > -1){  //BJ列高亮
							otagsA[j].style.color = "#FFA500";
						}
					}
					var value = otagsA[iCol].innerText.replace(/(万)|(亿)/g,'');
					if(!isNaN(parseFloat(value)) && isFinite(value)){  //判断列是否为数字
						if(parseFloat(value) >= 0){
							otagsA[iCol].style.color = "#FF6633";     //正负颜色
						}else{
							otagsA[iCol].style.color = "#00FF00";
						}
					}else{
						otagsA[iCol].style.color = "#FF6633";
					}
					
					//破板
					for (var j=0;j < otagsA.length; j++){	//列遍历
						var value = otagsA[j].innerText;
						if(value == "破板"){
							otagsA[j].style.color = "#00FF00";
						}
					}		
				}					
			}	
			
			var chnNumChar = {零:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9};

			var chnNameValue = {
			  十:{value:10, secUnit:false},
			  百:{value:100, secUnit:false},
			  千:{value:1000, secUnit:false},
			  万:{value:10000, secUnit:true},
			  亿:{value:100000000, secUnit:true}
			}

			function ChineseToNumber(chnStr){
			  var rtn = 0;
			  var section = 0;
			  var number = 0;
			  var secUnit = false;
			  var str = chnStr.split('');

			  for(var i = 0; i < str.length; i++){
				var num = chnNumChar[str[i]];
				if(typeof num !== 'undefined'){
				  number = num;
				  if(i === str.length - 1){
					section += number;
				  }
				}else{
				  var unit = chnNameValue[str[i]].value;
				  secUnit = chnNameValue[str[i]].secUnit;
				  if(secUnit){
					section = (section + number) * unit;
					rtn += section;
					section = 0;
				  }else{
					section += (number * unit);
				  }
				  number = 0;
				}
			  }
			  return rtn + section;
			}

			function search(){   //点击列表中相对应的股票
				if(gpdm != ""){
					var rows = document.getElementById("towrite2").getElementsByTagName('tr');
					for(var i = 0; i < rows.length; i++){	
						var rid = rows[i].id;					
						if(rid == gpdm){												
							//rows[i].getElementsByTagName('a')[0].click();
							//$("#" + rid + " a")[0].click();		
							rows[i].style.backgroundColor = "#B03060"; 
							break;
						}
					}
				}
			}	

			function updatez() {
				var dm = bdm; 			 						
				//var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=1&ZZ=1&a=PlateIntroduction&st=30&c=ZhiShuRanking&PhoneOSNew=1&Index=0&apiv=w24&Type=2&PlateID=" + dm + "&"; 								
				//var url2 = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=ZhiShuStockList_W8&st=30&c=ZhiShuRanking&PhoneOSNew=1&IsZZ=1&Index=0&apiv=w26&Type=6&PlateID=" + dm + "&Date=" + tt + "&"; 
				var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=1&ZZ=1&a=PlateIntroduction&st=30&c=ZhiShuRanking&PhoneOSNew=1&Index=0&apiv=w24&Type=2&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PlateID=" + dm + "&"; 								
				var url2 = "https://apphis.longhuvip.com/w1/api/index.php?Order=1&a=ZhiShuStockList_W8&st=30&c=ZhiShuRanking&PhoneOSNew=1&IsZZ=1&Index=0&apiv=w26&Type=6&PlateID=" + dm + "&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&Date=" + tt + "&"; 
				var url = url1;
				if(k == "1"){
					url = url2;
				}							
				
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));	
						if(k == "0"){
							for (i = 0; i < data.List.length; i++){							
								res.push({"code":data.List[i][0],"name":data.List[i][1],"zf":data.List[i][3],"lzcs":data.List[i][4]});												
							}
						}else{
							for (i = 0; i < data.list.length; i++){							
								res.push({"code":data.list[i][0],"name":data.list[i][1],"zf":data.list[i][6],"lz":data.list[i][24],"zl":data.list[i][2],"lb":data.list[i][23]});
							}							
						}							
					}
				});			
							
				var data = JSON.stringify(res);
				data = '{\"list\":' + data + "}";
				//document.write(data);
				
				var transform_aa = [           
				{"tag":"p", children:function(){return(json2html.transform(this.list, transform_bb));}}
				];
				
				var transform_bb="";
				if(k == "0"){
					transform_bb= 
					{"tag":"p", children:[
					{"tag":"p", children:[											
					{"tag": "p", "html":"<a href='http://www.treeid/code_${code}' onclick='changeCss1(this,\"towrite2\")'>${code} ${name}&nbsp;涨幅:${zf}%&nbsp;领涨次数:${lzcs}</a>"}, 
					]}]}; 
				}else{
					transform_bb= 
					{"tag":"p", children:[
					{"tag":"p", children:[											
					{"tag": "p", "html":"<a href='http://www.treeid/code_${code}' >${code} ${name}&nbsp;&nbsp;涨幅：${zf}%&nbsp;&nbsp;${lb}</a>"}, 
					]}]}; 
				}
				var html = json2html.transform(data, transform_aa);	
				var bfyy = "<a style='padding-left:10px;font-size:14px;' href='javascript:void(0)' onclick='updateb()'>【爆发原因】</a>";
				var qb = "<a style='float:right;margin-right:2px;10px;font-size:14px;' href='javascript:void(0)' onclick='update(" + "0" + ")'>全部</a>";				
				div2 = document.getElementById('towrite2');				
				div2.innerHTML = '<h4>' + bkmc + bfyy + qb + '</h4>';										
				div2.innerHTML += html;
				div2.style.whiteSpace = "nowrap";						
			}
			
			function updateb() {
				var dm = bdm; 			 				
				//var url4 = "https://apphq.longhuvip.com/w1/api/index.php?a=GetBaseFaceListZDEvnArtNew&apiv=w26&c=ZhiShuL2Data&StockID=" + dm;				
				//var url5 = "https://apphis.longhuvip.com/w1/api/index.php?a=GetDayBaseFaceListZDEvnArt&st=10&c=ZhiShuKLine&apiv=w26&StockID=" + dm; 								
				var url4 = "https://apphq.longhuvip.com/w1/api/index.php?a=GetBaseFaceListZDEvnArtNew&apiv=w26&c=ZhiShuL2Data&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + dm;				
				var url5 = "https://apphis.longhuvip.com/w1/api/index.php?a=GetDayBaseFaceListZDEvnArt&st=10&c=ZhiShuKLine&apiv=w26&VerSion=5.14.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + dm; 
				var res4 = [];
				$.ajax({
					type: "get",
					url: url4,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));							
						res4 = data;								
					}
				});				

				var res5 = [];
				$.ajax({
					type: "get",
					url: url5,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));							
						res5 = data;									
					}
				});		
				
				var fh = "<a style='padding-left:10px;font-size:14px;' href='javascript:void(0)' onclick='update(" + "0" + ")'>【返回】</a>";
				var zz = "<a style='float:right;font-size:14px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";				
				div2 = document.getElementById('towrite2');				
				div2.innerHTML = '<h4>' + bkmc + fh + zz + '</h4>';	
				var rq = res4.Date;
				
				//if(data.indexOf('"Date":""') == -1){
				if(rq != ""){					
					var data = JSON.stringify(res4);
					data = '{"List":[' + data + ']}';					
					var day = new Date();
					gt = day.getTime();			
					mymonth = day.getMonth()+1;
					myday = day.getDate();
					if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
					if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
					tt = day.getFullYear() + "-" + mymonth + "-" + myday;													
					
					if(rq == tt){						
						var transform_aa = [           
							{"tag":"ul", children:function(){return(json2html.transform(this.List, transform_bb));}}
							];
							
							var transform_bb= 
							{"tag":"p", children:[
							{"tag":"li", children:[							
							{"tag": "p style=color:#FFFF00;font-size:14px;", "html":"${Date}：${BoomReason}"},
							{"tag": "p style=margin-top:-15px;color:#FFA500;font-size:14px;", "html":"${Title}"}, 								
							]}]}; 
						
						var html = json2html.transform(data, transform_aa);																						
						div2.innerHTML += html;
					}
				}
				
				//if(data1.indexOf('\"List\":[]') == -1){
				if(res5.List.length > 0){
					var data1 = JSON.stringify(res5);
					var transform_aa = [           
						{"tag":"ul", children:function(){return(json2html.transform(this.List, transform_bb));}}
						];
						
						var transform_bb= 
						{"tag":"p", children:[
						{"tag":"li", children:[							
						{"tag": "p style=color:#E1FFFF;font-size:14px;", "html":"${Date}：${BoomReason}"},
						{"tag": "p style=margin-top:-5px;color:#FFA500;font-size:14px;", "html":"${Title}"}, 							
						]}]}; 
					
					var html = json2html.transform(data1, transform_aa);					
					div2.innerHTML += html;
				//}else if(data1.indexOf('\"List\":[]') > -1 && data.indexOf('"Date":""') > -1){
				}else if(res5.List.length == 0 && rq == ""){
					div2.innerHTML += "暂无数据";	
				}
				div2.style.whiteSpace = "normal";  //折行												
			}
		</script>	
	</body>
</html>